<template>
  <div class="detaileimg">
    <img :src="drawerdata.iconPath">
  </div>
  <a-descriptions bordered layout="vertical">
    <a-descriptions-item label="应用名称">
      {{ drawerdata.name }}
    </a-descriptions-item>
    <a-descriptions-item label="应用大小">
      {{ drawerdata.appSize }}
    </a-descriptions-item>
    <a-descriptions-item label="账号池" v-if=" drawerdata.accountPool">
      {{ drawerdata.accountPool }}
    </a-descriptions-item>
    <a-descriptions-item label="打包版本" v-if="drawerdata.apptype!='miaoModel'">
      {{ drawerdata.version }}
    </a-descriptions-item>
    <a-descriptions-item label="构建版本" v-if="drawerdata.apptype!='miaoModel'">
      {{ drawerdata.build }}
    </a-descriptions-item>
    <a-descriptions-item label="IPA下载" v-if="drawerdata.apptype!='miaoModel'">
      <a :href="drawerdata.appPath">点击下载</a>
    </a-descriptions-item>
    <a-descriptions-item label="上传时间">
      {{ FormatTime(drawerdata.time) }}
    </a-descriptions-item>
    <a-descriptions-item label="应用包名">
      {{ drawerdata.package }}
    </a-descriptions-item>
    <a-descriptions-item label="更新描述" v-if=" drawerdata.accountPool">
      <div class="acolor" @click="newClick">更新描述</div>
    </a-descriptions-item>
  </a-descriptions>
</template>

<script lang='ts'>
import { reactive, SetupContext, toRefs } from "vue";
import { FormatTime } from "@/CommonAssets/index";
import { notification } from "ant-design-vue";
import { updateMobile } from "@/api/superApi";
export default {
  name: "详情资料 ",
  props: {
    drawerdata: Object,
  },
  setup(props: any, ctx: SetupContext) {
    const data = reactive({
      drawerdata: props.drawerdata,
    });

    const newClick = async () => {
      try {
        await updateMobile({
          userid: props.drawerdata.userid,
          lid: props.drawerdata.lid,
          apptype: props.drawerdata.apptype,
        });

        notification["success"]({
          message: "更新成功",
        });
      } catch (error) {
        notification["error"]({
          message: "更新失败",
        });
      }
    };

    return {
      ...toRefs(data),
      FormatTime,
      newClick,
    };
  },
};
</script>
<style lang="less" scoped>
.detaileimg {
  width: 80px;
  height: 80px;
  margin: 50px auto;
  border-radius: 19px;
  overflow: hidden;
  box-shadow: 1px 1px 18px 1px rgba(126, 125, 125, 0.61);
  img {
    width: 100%;
  }
}
.acolor {
  color: #40a9ff;
  cursor: pointer;
}
</style>